const windowSize = {
    width: document.documentElement.clientWidth,
    height: document.documentElement.clientHeight,
    ratio: window.devicePixelRatio,
    scale: document.documentElement.clientWidth / 375
}
let str = 'width=375, initial-scale=' + windowSize.scale + ', maximum-scale=' +
    windowSize.scale + ', user-scalable=0'
document.getElementById('viewport').setAttribute('content', str)


if (/Android [4-9]/.test(navigator.appVersion)) {
    window.addEventListener("resize", function () {
        if (document.activeElement.tagName == "INPUT" || document.activeElement.tagName == "TEXTAREA") {
            window.setTimeout(function () {
                document.activeElement.scrollIntoViewIfNeeded();
            }, 0);
        }
    })
}



//封装的常规操作，停留在本页面

function doIt() {
    if (window.history && window.history.pushState) {
        window.addEventListener('popstate', function () {
            window.history.pushState('forward', null, '');
            window.history.forward(1);
        });
    }
    window.history.pushState('forward', null, '');
    window.history.forward(1);
    
}
doIt()

